#ifndef OCCUPATION_HPP_INCLUDED
#define OCCUPATION_HPP_INCLUDED

#include <vector>

#include "city_fwd.hpp"
#include "resource_fwd.hpp"

class citizen;
class merchant_occupation;
class world;

namespace hex {
class tile;
}

class occupation
{
public:
	static const std::vector<const occupation*>& all();
	virtual ~occupation();
	virtual bool available_in_city(const_city_ptr c) const { return true; }
	virtual int earnings_estimate(const world& w, const_city_ptr ct, const citizen& cz) const = 0;
	virtual int capital_required(const world& w, const_city_ptr ct) const { return 0; }
	virtual const char* description() const = 0;
	virtual bool do_work(world& w, hex::tile& t, citizen& c) const { return true; }
};

class merchant_occupation : public occupation
{
public:
	static const merchant_occupation* instance();
	int earnings_estimate(const world& w, const_city_ptr ct, const citizen& cz) const;
	const char* description() const { return "Merchant"; }
};

class craftsman_occupation : public occupation
{
public:
	// initializes based on looking up global resources.
	static void init();
	explicit craftsman_occupation(const_resource_ptr r);
	int earnings_estimate(const world& w, const_city_ptr ct, const citizen& cz) const;
	int capital_required(const world& w, const_city_ptr ct) const;
	const char* description() const;
	bool do_work(world& w, hex::tile& t, citizen& c) const;
private:
	std::string description_;
	const_resource_ptr resource_;
};

#endif
